from django import forms


class UserLRForm(forms.Form):
    username = forms.CharField(
        label="用户名",
        min_length=2,
        max_length=20,
        error_messages={
            "min_length": "用户名长度至少2个字符",
            "max_length": "用户名长度不能超过20个字符"
        }
    )
    password = forms.CharField(
        label="密码",
        min_length=6,
        max_length=20,
        error_messages={
            "min_length": "密码长度至少6个字符",
            "max_length": "密码长度不能超过20个字符"
        },
        # input输入框的类型发生了改变，默认是文本类型
        # 需要修改为密码框类型
        widget=forms.PasswordInput(attrs={'class': 'form-control'})
    )